
import java.util.*;
public class TestInterrupted {
 public static void main(String[] args) {
  MyThread thread = new MyThread();
  Thread t = new Thread(thread);
  t.start();
  try {
  Thread.sleep(10000);
  } catch (InterruptedException a) {
  }
  t.interrupt();
 }
}

 
class MyThread implements Runnable {
 public void run() {
  while(true) {
   System.out.println("---" + new Date() + "---");
   try {
     Thread.sleep(1000);
   } catch (InterruptedException e) {
    return;
   }
  }
 }
}
